using System;
using System.Collections.Generic;
using System.Text;

using NUnit.Framework;
using usm.SolDev.Common;

namespace usm.SolDev.NUnit
{
    /// <summary>
    ///     This NUnit enabled class is used to test cryptography
    /// </summary>
    [TestFixture]
    public class TestCriptografy
    {
        private string simpleText;
        [SetUp]
        public void Init()
        {
            simpleText = "Hello NUnit World!";
        }

        [Test]
        public void TestRSA()
        {
            string encryptedString = Cryptography.CryptRSA(simpleText);
            Assert.IsTrue(simpleText.Equals(Cryptography.DecryptRSA(encryptedString)), "The decrypted text do not match original");
        }

        [Test]
        public void TestSHA256()
        {
            Cryptography.ComputeHashWithSHA256(simpleText);
        }

        [Test]
        public void TestBase64()
        {
            string base64Encoded = Cryptography.Base64Encode(simpleText);
            Assert.IsTrue(simpleText.Equals(Cryptography.Base64Decode(base64Encoded)), "The base64 decoded text do not match original");
        }
    }
}
